package com.example.test.test;

import com.example.test.entity.Man;
import com.example.test.handler.InvocationHandlerImpl;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

public class ProxyTest2 {
    public static void main(String[] args) {
        Man m = new Man();

        InvocationHandler handler = new InvocationHandlerImpl(m);

        ClassLoader loader=m.getClass().getClassLoader();
        Class []interfaces=m.getClass().getInterfaces();

        Object o = Proxy.newProxyInstance(loader, interfaces, handler);

        System.out.println(o.getClass().getName());
    }
}
